# from operator import attrgetter

from compKey.comp_key import comp_key

# dict_test = {}
#
# comp_key_temp = comp_key("aabb", 'ttmm')
#
# dict_test["aaa"] = comp_key("aabb", 'ttmm')
# dict_test["aaa"].mid_word.append("bbb")
# dict_test["bbb"] = comp_key("aabb", 'ttmm')
# dict_test["bbb"].mid_word.append("ttt")
# for name in dict_test:
#     # print(dict_test[])
#     print(dict_test[name].mid_word)


comp_key_list = []
comp_key_temp = comp_key('aaa', 'bbb')
comp_key_temp.comp = 10
comp_key_list.append(comp_key_temp)

comp_key_temp = comp_key('aaa', 'bbb')
comp_key_temp.comp = 20
comp_key_list.append(comp_key_temp)

comp_key_temp = comp_key('aaa', 'bbb')
comp_key_temp.comp = 7
comp_key_list.append(comp_key_temp)

comp_key_temp = comp_key('aaa', 'bbb')
comp_key_temp.comp = 21
comp_key_list.append(comp_key_temp)

comp_key_temp = comp_key('aaa', 'bbb')
comp_key_temp.comp = 1
comp_key_list.append(comp_key_temp)

# sorted(comp_key_list, key=attrgetter("comp"))
comp_key_list = sorted(comp_key_list, key=lambda comp: comp.comp, reverse=True)

for item in comp_key_list:
    print(item.comp)
